//
//  WeChatQQStaticLibHeader.h
//  WeChatQQStaticLibDemo
//
//  Created by mac on 16/12/22.
//  Copyright © 2016年 srulos. All rights reserved.
//

#ifndef WeChatQQStaticLibHeader_h
#define WeChatQQStaticLibHeader_h

#import "QQLoginViewController.h"
#import "MBProgressHUD.h"
#import "WeChatQQApi.h"
#import "MBProgressHUD.h"
#import "QQLoginViewController.h"
#import "QRCodeLoginViewController.h"
#import "MPLoginViewController.h"

//hud
#define SHOW_HUD(_text)\
MBProgressHUD * progressHUD = [[MBProgressHUD alloc] initWithView:self.view];\
progressHUD.labelText = _text;\
[self.view addSubview:progressHUD];\
[self.view bringSubviewToFront:progressHUD];\
[progressHUD show:YES];\
[progressHUD hide:YES afterDelay:20];

#define SHOW_HUD_MESSAGE(title)\
MBProgressHUD * hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];\
hud.mode = MBProgressHUDModeText;\
CGFloat animationTime = title.length / 12.0f;\
if (animationTime < 1.0) {\
animationTime = 1.5;\
}\
[hud hide:YES afterDelay:animationTime];\
if(title.length > 15){\
[hud setDetailsLabelText:title];\
}\
else{\
[hud setLabelText:title];\
}

#define HIDE_HUD [MBProgressHUD hideHUDForView:self.view animated:YES];

//show login view controller
#define SHOW_LOGIN_VIEW_CONTROLLER(_color)\
if([WeChatQQApi stander].m_isLogin == NO){\
if([WeChatQQApi stander].m_loginType == LT_QQ){\
QQLoginViewController * qqLoginViewController = [[QQLoginViewController alloc]initWithNibName:@"QQLoginViewController" bundle:nil];\
[qqLoginViewController updateMainColor:_color];\
UINavigationController * qqNavigationController = [[UINavigationController alloc]initWithRootViewController:qqLoginViewController];\
[self presentViewController:qqNavigationController animated:YES completion:nil];\
return;\
}\
else if([WeChatQQApi stander].m_loginType == LT_WECHAT){\
QRCodeLoginViewController * qrcodeLoginViewController = [[QRCodeLoginViewController alloc]initWithNibName:@"QRCodeLoginViewController" bundle:nil];\
[qrcodeLoginViewController updateSaveBtnColor:_color];\
UINavigationController * wechatNavigationController = [[UINavigationController alloc]initWithRootViewController:qrcodeLoginViewController];\
[self presentViewController:wechatNavigationController animated:YES completion:nil];\
return;\
}\
else if([WeChatQQApi stander].m_loginType == LT_MP){\
MPLoginViewController * mpLoginViewController = [[MPLoginViewController alloc]initWithNibName:@"MPLoginViewController" bundle:nil];\
[mpLoginViewController updateSaveBtnColor:_color];\
UINavigationController * mpLoginNavigationController = [[UINavigationController alloc]initWithRootViewController:mpLoginViewController];\
[self presentViewController:mpLoginNavigationController animated:YES completion:nil];\
return;\
}\
}

//create border
#define CREATE_BORDER_EXTEND(view,radius,width,r,g,b,a)\
view.layer.cornerRadius = radius;\
view.layer.borderWidth = width;\
view.layer.borderColor = [UIColor colorWithRed:r / 255.0 green:g / 255.0 blue:b / 255.0 alpha:a].CGColor;

#endif /* WeChatQQStaticLibHeader_h */
